package com.rx.school.controller;

import com.rx.core.base.RxBaseConstant;
import com.rx.core.base.RxBaseController;
import com.rx.school.service.SchoolService;
import com.rx.school.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 公开接口
 */
@RestController
@RequestMapping(RxBaseConstant.CONFIG_COMMON_API)
@Slf4j
public class SchoolController extends RxBaseController {

    @Autowired
    SchoolService schoolService;

    @PostMapping(value = "/school-home")
    public Object schoolHome(@RequestBody SchoolHome schoolHome) throws IllegalAccessException, InstantiationException {
        return schoolService.schoolHome(schoolHome);
    }

    @PostMapping(value = "/school-home-info")
    public Object schoolHomeInfo(@RequestBody SchHomeInfo schoolHome) throws IllegalAccessException, InstantiationException {
        return schoolService.schoolHomeInfo(schoolHome);
    }

    @PostMapping(value = "/school-article")
    public Object schoolArticle(@RequestBody SchArticleInfo schArticleInfo) throws IllegalAccessException, InstantiationException {
        return schoolService.schoolArticle(schArticleInfo);
    }

    /**
     * 根据文章查询作者
     * @param
     * @return
     * @throws IllegalAccessException
     * @throws InstantiationException
     */
    @PostMapping(value = "/school-article-person")
    public Object schoolArticlePerson(@RequestBody  List<String> bidList) throws IllegalAccessException, InstantiationException {
        return schoolService.schoolArticlePerson(bidList);
    }

    @PostMapping(value = "/school-leader-person")
    public Object schoolLeaderPerson(@RequestBody SchPresidentInfo schPresidentInfo) throws IllegalAccessException, InstantiationException {
        return schoolService.schoolLeaderPerson(schPresidentInfo);
    }

    @PostMapping(value = "/school-normal-person")
    public Object schoolNormalPerson(@RequestBody SchPersonInfo schPersonInfo) throws IllegalAccessException, InstantiationException {
        return schoolService.schoolNormalPerson(schPersonInfo);
    }

    @PostMapping(value = "/school-history-person")
    public Object schoolHistoryPerson(@RequestBody SchPresidentHistory schPersonInfo) throws IllegalAccessException, InstantiationException {
        return schoolService.schoolHistoryPerson(schPersonInfo);
    }

    @PostMapping(value = "/school-party-build")
    public Object schoolPartyBuild(@RequestBody SchArticleInfo shArticleInfo) throws IllegalAccessException, InstantiationException {
        return schoolService.schoolPartyBuild(shArticleInfo);
    }

    @PostMapping(value = "/link-list")
    public Object linkList(@RequestBody SchLinkInfo schLinkInfo) throws IllegalAccessException, InstantiationException {
        return schoolService.linkList(schLinkInfo);
    }

    @PostMapping(value = "/subject-scores-list")
    public Object subjectScoresList(@RequestBody SubjectScoresInfo subjectScoresInfo) throws IllegalAccessException, InstantiationException {
        return schoolService.subjectScoresList(subjectScoresInfo);
    }

    @PostMapping(value = "/subject-scores-statistics")
    public Object subjectScoresStatistics(@RequestBody SubjectScoresInfo subjectScoresInfo) throws IllegalAccessException, InstantiationException {
        return schoolService.subjectScoresStatistics(subjectScoresInfo);
    }
}
